﻿using Microsoft.Extensions.DependencyInjection;

namespace WYJ.SDK.Web
{
    public static class Extensions
    {
        public static IServiceCollection AddCors(this IServiceCollection services,IEnumerable<KeyValuePair<string, WYJCorsPolicy>> policies)
        {
            services.AddCors(options =>
            {
                foreach (var policy in policies)
                {
                    options.AddPolicy(policy.Key, policy.Value);
                }
            });
            return services;
        }

    }
}